home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / Balloons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  9.7 KB  |  241 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        Balloons.h
  3.  
  4.      Contains:    Balloon Help Package Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __BALLOONS__
  21. #define __BALLOONS__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __QUICKDRAW__
  30. #include <Quickdraw.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <QuickdrawText.h>                                    */
  34.  
  35. #ifndef __MENUS__
  36. #include <Menus.h>
  37. #endif
  38. /*    #include <Memory.h>                                            */
  39.  
  40. #ifndef __TEXTEDIT__
  41. #include <TextEdit.h>
  42. #endif
  43.  
  44. #ifndef __ERRORS__
  45. #include <Errors.h>
  46. #endif
  47.  
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51.  
  52. #if PRAGMA_ALIGN_SUPPORTED
  53. #pragma options align=mac68k
  54. #endif
  55.  
  56. #if PRAGMA_IMPORT_SUPPORTED
  57. #pragma import on
  58. #endif
  59.  
  60.  
  61. enum {
  62.     hmBalloonHelpVersion        = 0x0002,                        /* The real version of the Help Manager */
  63.     kHMHelpMenuID                = -16490,                        /* Resource ID and menu ID of help menu */
  64.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help… */
  65.     kHMShowBalloonsItem            = 3,                            /* help menu item number of Show/Hide Balloons */
  66.     kHMHelpID                    = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  67.     kBalloonWDEFID                = 126,                            /* Resource ID of the WDEF proc used in standard balloons */
  68. /* Dialog item template type constant */
  69.     helpItem                    = 1,                            /* key value in DITL template that corresponds to the help item */
  70. /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  71.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  72.     hmUseSubID                    = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  73.     hmAbsoluteCoords            = 2                                /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  74. };
  75.  
  76. enum {
  77.     hmSaveBitsNoWindow            = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  78.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  79.     hmMatchInTitle                = 16,                            /* for hwin resources, match string anywhere in window title string */
  80. /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  81.     kHMStringItem                = 1,                            /* pstring used in resource */
  82.     kHMPictItem                    = 2,                            /* 'PICT' ResID used in resource */
  83.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  84.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  85.     kHMSTRResItem                = 7,                            /* 'STR ' ResID used in resource */
  86.     kHMSkipItem                    = 256,                            /* don't display a balloon */
  87.     kHMCompareItem                = 512,                            /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  88.     kHMNamedResourceItem        = 1024,                            /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  89.     kHMTrackCntlItem            = 2048,                            /* Reserved */
  90. /* Constants for hmmHelpType's when filling out HMMessageRecord */
  91.     khmmString                    = 1,                            /* help message contains a PString */
  92.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  93.     khmmStringRes                = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  94.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  95.     khmmPictHandle                = 5,                            /* help message contains a Picture handle */
  96.     khmmTERes                    = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  97.     khmmSTRRes                    = 7,                            /* help message contains a res ID to a 'STR ' resource */
  98.     kHMEnabledItem                = 0                                /* item is enabled, but not checked or control value = 0 */
  99. };
  100.  
  101. enum {
  102. /* ResTypes for Styled TE Handles in Resources */
  103.     kHMTETextResType            = 'TEXT',                        /* Resource Type of text data for styled TE record w/o style info */
  104.     kHMTEStyleResType            = 'styl'
  105. };
  106.  
  107. enum {
  108.     kHMDisabledItem                = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  109.     kHMCheckedItem                = 2,                            /* item is enabled, and checked or control value = 1 */
  110.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  111. /* Method parameters to pass to HMShowBalloon */
  112.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  113.     kHMSaveBitsNoWindow            = 1,                            /* Just save the bits and draw (for MDEF calls) */
  114.     kHMSaveBitsWindow            = 2                                /* Regular window, save bits behind, AND generate update event */
  115. };
  116.  
  117. enum {
  118. /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  119.     kHMMenuResType                = 'hmnu',                        /* ResType of help resource for supporting menus */
  120.     kHMDialogResType            = 'hdlg',                        /* ResType of help resource for supporting dialogs */
  121.     kHMWindListResType            = 'hwin',                        /* ResType of help resource for supporting windows */
  122.     kHMRectListResType            = 'hrct',                        /* ResType of help resource for rectangles in windows */
  123.     kHMOverrideResType            = 'hovr',                        /* ResType of help resource for overriding system balloons */
  124.     kHMFinderApplResType        = 'hfdr'
  125. };
  126.  
  127. struct HMStringResType {
  128.     short                            hmmResID;
  129.     short                            hmmIndex;
  130. };
  131. typedef struct HMStringResType HMStringResType;
  132.  
  133. struct HMMessageRecord {
  134.     SInt16                            hmmHelpType;
  135.     union {
  136.         Str255                            hmmString;
  137.         SInt16                            hmmPict;
  138.         TEHandle                        hmmTEHandle;
  139.         HMStringResType                    hmmStringRes;
  140.         SInt16                            hmmPictRes;
  141.         PicHandle                        hmmPictHandle;
  142.         SInt16                            hmmTERes;
  143.         SInt16                            hmmSTRRes;
  144.     } u;
  145. };
  146.  
  147. typedef struct HMMessageRecord HMMessageRecord;
  148.  
  149. typedef HMMessageRecord *HMMessageRecPtr;
  150.  
  151. typedef pascal OSErr (*TipFunctionProcPtr)(Point tip, RgnHandle structure, Rect *r, short *balloonVariant);
  152.  
  153. #if GENERATINGCFM
  154. typedef UniversalProcPtr TipFunctionUPP;
  155. #else
  156. typedef TipFunctionProcPtr TipFunctionUPP;
  157. #endif
  158.  
  159. enum {
  160.     uppTipFunctionProcInfo = kPascalStackBased
  161.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  162.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Point)))
  163.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(RgnHandle)))
  164.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect*)))
  165.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short*)))
  166. };
  167.  
  168. #if GENERATINGCFM
  169. #define NewTipFunctionProc(userRoutine)        \
  170.         (TipFunctionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  171. #else
  172. #define NewTipFunctionProc(userRoutine)        \
  173.         ((TipFunctionUPP) (userRoutine))
  174. #endif
  175.  
  176. #if GENERATINGCFM
  177. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  178.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  179. #else
  180. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  181.         (*(userRoutine))((tip), (structure), (r), (balloonVariant))
  182. #endif
  183.  
  184. /*  Public Interfaces  */
  185. extern pascal OSErr HMGetHelpMenuHandle(MenuHandle *mh)
  186.  THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  187. extern pascal OSErr HMShowBalloon(const HMMessageRecord *aHelpMsg, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, SInt16 balloonVariant, SInt16 method)
  188.  THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  189. extern pascal OSErr HMRemoveBalloon(void)
  190.  THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  191. extern pascal Boolean HMGetBalloons(void)
  192.  THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  193. extern pascal OSErr HMSetBalloons(Boolean flag)
  194.  THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  195. extern pascal OSErr HMShowMenuBalloon(SInt16 itemNum, SInt16 itemMenuID, SInt32 itemFlags, SInt32 itemReserved, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, SInt16 balloonVariant)
  196.  THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  197. extern pascal OSErr HMGetIndHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, UInt32 *options, Point *tip, Rect *altRect, SInt16 *theProc, SInt16 *balloonVariant, HMMessageRecord *aHelpMsg, SInt16 *count)
  198.  THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  199. extern pascal Boolean HMIsBalloon(void)
  200.  THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  201. extern pascal OSErr HMSetFont(SInt16 font)
  202.  THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  203. extern pascal OSErr HMSetFontSize(UInt16 fontSize)
  204.  THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  205. extern pascal OSErr HMGetFont(SInt16 *font)
  206.  THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  207. extern pascal OSErr HMGetFontSize(UInt16 *fontSize)
  208.  THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  209. extern pascal OSErr HMSetDialogResID(SInt16 resID)
  210.  THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  211. extern pascal OSErr HMSetMenuResID(SInt16 menuID, SInt16 resID)
  212.  THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  213. extern pascal OSErr HMBalloonRect(const HMMessageRecord *aHelpMsg, Rect *coolRect)
  214.  THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  215. extern pascal OSErr HMBalloonPict(const HMMessageRecord *aHelpMsg, PicHandle *coolPict)
  216.  THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  217. extern pascal OSErr HMScanTemplateItems(SInt16 whichID, SInt16 whichResFile, ResType whichType)
  218.  THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  219. extern pascal OSErr HMExtractHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, HMMessageRecord *aHelpMsg)
  220.  THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  221. extern pascal OSErr HMGetDialogResID(SInt16 *resID)
  222.  THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  223. extern pascal OSErr HMGetMenuResID(SInt16 menuID, SInt16 *resID)
  224.  THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  225. extern pascal OSErr HMGetBalloonWindow(WindowRef *window)
  226.  THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  227.  
  228. #if PRAGMA_IMPORT_SUPPORTED
  229. #pragma import off
  230. #endif
  231.  
  232. #if PRAGMA_ALIGN_SUPPORTED
  233. #pragma options align=reset
  234. #endif
  235.  
  236. #ifdef __cplusplus
  237. }
  238. #endif
  239.  
  240. #endif /* __BALLOONS__ */
  241.